<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: class.main.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

 class main {

 	function __construct() {
 		global $db;
 		$this->SHIPPING = array();

		$status = $db->db_query("SELECT
									shipping_status_name,
									shipping_status_image,
									shipping_status_id
                                 FROM
                                 	".TABLE_SHIPPING_STATUS."
		                         WHERE
		                         	language_id = '".(int)$_SESSION['languages_id']."'", true);

         while(!$status->EOF) {
         	$this->SHIPPING[$status->fields['shipping_status_id']] = array('name' => $status->fields['shipping_status_name'], 
																			'image' => $status->fields['shipping_status_image']);
         	$status->MoveNext();
         }
 	}

 	function getShippingStatusName($id) {
 		return $this->SHIPPING[$id]['name'];
 	}
 	function getShippingStatusImage($id) {
 		if ($this->SHIPPING[$id]['image'])
 			return DIR_WS_IMAGES.$this->SHIPPING[$id]['image'];
 		else
 			return;
 	}

 	function getShippingLink() {
 		if(SITE_OVERLAYS == 'true')
 			$link = ' '.SHIPPING_EXCL.' <a rel="nofollow" title="" class="shipping" href="'.href_link(FILENAME_POPUP_CONTENT, 'coID='.SHIPPING_INFOS.'&amp;iframe=true').'">'.SHIPPING_COSTS.'</a>';
 		else
			$link = ' '.SHIPPING_EXCL.' <a rel="nofollow" target="_blank" href="'.href_link(FILENAME_POPUP_CONTENT, 'coID='.SHIPPING_INFOS).'">'.SHIPPING_COSTS.'</a>';
		return $link;
	}

	function getTaxNotice() {
		if ($_SESSION['customers_status']['customers_status_show_price'] == 0)
			return;

		if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0)
			return TAX_INFO_INCL_GLOBAL;

		if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1)
			return TAX_INFO_ADD_GLOBAL;

		if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0)
			return TAX_INFO_EXCL_GLOBAL;

		return;
	}

	function getTaxInfo($tax_rate) {
		if(MODULE_SMALL_BUSINESS_STATUS != 'true') {
			if ($tax_rate > 0 && $_SESSION['customers_status']['customers_status_show_price_tax'] != 0)
				$tax_info = sprintf(TAX_INFO_INCL, $tax_rate.' %');

			if ($tax_rate > 0 && $_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1)
				$tax_info = sprintf(TAX_INFO_ADD, $tax_rate.' %');

			if ($tax_rate > 0 && $_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0)
				$tax_info = sprintf(TAX_INFO_EXCL, $tax_rate.' %');
		} else
			$tax_info = USE_SMALL_BUSINESS_TEXT.' | ';
		return $tax_info;
	}

	function getShippingNotice() {
		if (SHOW_SHIPPING == 'true') {
			if(SITE_OVERLAYS == 'true')
	 			$link = ' '.SHIPPING_EXCL.'<a rel="nofollow" title="" class="shipping" href="'.href_link(FILENAME_POPUP_CONTENT, 'coID='.SHIPPING_INFOS.'&amp;iframe=true').'"> '.SHIPPING_COSTS.'</a>';
	 		else
				$link = ' '.SHIPPING_EXCL.'<a rel="nofollow" target="_blank" href="'.href_link(FILENAME_POPUP_CONTENT, 'coID='.SHIPPING_INFOS).'"> '.SHIPPING_COSTS.'</a>';

			return $link;
		}
		return;
	}

	function getContentLink($coID,$text) {
		if(SITE_OVERLAYS == 'true')
			return '<a rel="nofollow" class="shipping" href="javascript:popupWindowShipping(\''.href_link(FILENAME_POPUP_CONTENT, 'coID='.$coID.'&iframe=true').'\')"><span style="color:#b20000">'.$text.'</span></a>';
		else
			return '<a rel="nofollow" href="'.href_link(FILENAME_POPUP_CONTENT, 'coID='.$coID).')"><span style="color:#b20000">'.$text.'</span></a>';
	}
}